import React, { Component } from 'react';

/**
 * TemperatureInput 组件
 */
export default class TemperatureInput extends Component {
    
      handleChange(e) {
        this.props.onTemperatureChange(e.target.value);
      }
    
      render() {
        const temperature = this.props.temperature;
        const scale = this.props.scale;
        return (
          <fieldset>
            <legend>Enter temperature in {scale}:</legend>
            <input value={temperature}
                   onChange={(e) => this.handleChange(e)} />
          </fieldset>
        );
      }
}
